<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2025/1/7
  Time: 16:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <style>
        table{
            border: 1px solid black;
            border-spacing: 0;
            border-collapse: collapse;
        }
        td{
            border: 1px solid black;
        }
    </style>
    <script>
        function deleteUser(id){
            //用户安全提示
            if(confirm("您确定要删除吗？")){
                //访问路径
                location.href="/delete?id="+id;
            }
        }
    </script>
</head>
<body>
<h2>List!!!!!!</h2>
姓名:<input type="text"> 年龄:<input type="text"><button>查找</button><br>
    <table>
        <tr>
            <td>姓名</td>
            <td>年龄</td>
            <td>操作</td>
        </tr>
        <c:forEach items="${stus}" var="stu">
            <tr>
                <td>${stu.name}</td>
                <td>${stu.age}</td>
                <td>
                    <a href="detail?id=${stu.id}">修改</a>
                </td>
                <td>
                    <a href="javascript:deleteUser(${stu.id})">删除</a>
                </td>
            </tr>
        </c:forEach>
        <tr>
            <td colspan="4">
                <a href="insert">添加用户</a>
            </td>
        </tr>
    </table>
</body>
</html>
